home *** CD-ROM | disk | FTP | other *** search
/ Monster Media 1996 #14 / Monster Media No. 14 (April 1996) (Monster Media, Inc.).ISO / prog_d / isamexpt.zip / ISAMTABL.PAS < prev    next >
Pascal/Delphi Source File  |  1996-01-13  |  62KB  |  2,045 lines

  1. unit Isamtabl;
  2.  
  3. interface
  4.  
  5. uses
  6.   SysUtils, WinTypes, WinProcs, Messages, Classes, Graphics, Controls,
  7.   Forms, Dialogs, DsgnIntf,
  8.   UUseIsam, Filer, LowBrows,
  9.   Restruct, ReIndex, ExtCtrls;
  10.  
  11. type
  12.   TIsamTable = class(TComponent)
  13.   private
  14.     FActive      : Boolean;
  15.     FAnsiConvert : Boolean;
  16.     FTableName   : TFileName;
  17.     FUnitName    : TFileName;
  18.     FIsamKey     : TStringList;
  19.     FRecordName  : String;
  20.     FRecord      : TStringList;
  21.     FIID         : TStringList;
  22.     FNetz        : NetSupportType;
  23.     FSaveModus   : Boolean;
  24.     FSourceCreate: Boolean;
  25.     FBrowserName : String;
  26.     FHeaderName  : String;
  27.     Procedure MySave;
  28.     Function Check(Name : String; SS : TStringList) : Boolean;
  29.     procedure CheckInactive;
  30.     function GetActive: Boolean;
  31.     procedure SetActive(Value: Boolean);
  32.     procedure SetTableName(const Value: TFileName);
  33.  
  34.     procedure SetRecordName(const Value: String);
  35.     Procedure SetUnitName(const Value: TFileName);
  36.     {$IFDEF CodeGen}
  37.     Procedure Uses_Einfuegen(var SourceStrings: TStringList);
  38.     Procedure Record_Einfuegen(var SourceStrings: TStringList);
  39.     Procedure Data_Einfuegen(var SourceStrings: TStringList);
  40.     Procedure Key_Deklaration_Einfuegen(var SourceStrings: TStringList);
  41.     Procedure Key_Proc_Einfuegen(var SourceStrings: TStringList);
  42.     Procedure FormCreate_Einfuegen(var SourceStrings: TStringList);
  43.     Procedure FormCreate_Fuellen(var SourceStrings: TStringList);
  44.     Procedure FormResize_Fuellen(var SourceStrings: TStringList);
  45.     Procedure FormShow_Fuellen(var SourceStrings: TStringList);
  46.     Procedure HeaderCreate_Einfuegen(var SourceStrings: TStringList);
  47.     Procedure Browser_BuildRow_Einfuegen(var SourceStrings: TStringList);
  48.     Procedure Browser_Edit_Einfuegen(var SourceStrings: TStringList);
  49.     Procedure Klammern_Loeschen(var SourceStrings: TStringList);
  50.     {$ENDIF}
  51.     Procedure SetHeaderName(const Value: String);
  52.     Procedure SetBrowserName(const Value: String);
  53.     {$IFDEF CodeGen}
  54.     Procedure SetSourceCreate(const Value: Boolean);
  55.     {$ENDIF}
  56.     Function  GetFormName(SList: TStringList): String;
  57.  
  58.   protected
  59.     Procedure SetRecord(Value: TStringList);
  60.     Procedure SetKeyProc(Value: TStringList);
  61.     Procedure SetIIDProc(Value: TStringList);
  62.     Procedure SetNetz(Value: NetSupportType);
  63.     {$IFDEF CodeGen}
  64.     Procedure BrowRow(Var SListe: TStringList;Var II : Integer);
  65.     Procedure GetFeldProc_Einfuegen(var SourceStrings : TStringList);
  66.     {$ENDIF}
  67.     Procedure SetAnsiConvert(Const Value: Boolean);
  68.   public
  69.     IFBPtr    : IsamFileBlockPtr;
  70.     Key_Proc  : KeyProc;
  71.     RecSize   : Longint;
  72.     KeyNo     : Integer;
  73.     Ref       : Longint;
  74.     Key       : IsamKeyStr;
  75.     MaxKeys   : Byte;
  76.     IID       : IsamIndDescr;
  77.     EditFormIdent: String;
  78.     constructor Create(AOwner: TComponent); override;
  79.     destructor Destroy; override;
  80.     Procedure Open;
  81.     Procedure Close;
  82.     Procedure ClearFields(var DATA,DUP);
  83.     Procedure Delete(var DATA,DUP);
  84.     Procedure Insert(var DATA,DUP);
  85.     Procedure Append(var DATA,DUP);
  86.     Procedure UpdateRecord(var DATA, DUP);
  87.     Procedure Get(var DATA, DUP);
  88.     Procedure Next(var DATA,DUP);
  89.     Function  FindKey(Var Data,Dup;var Key1 : IsamKeyStr) : Boolean;
  90.     Function  FindNearest(Var Data,Dup; Key1 : IsamKeyStr) : Boolean;
  91.     Procedure Prior(var DATA,DUP);
  92.     Procedure First(var DATA,DUP);
  93.     Procedure Last(var DATA,DUP);
  94.     Procedure CreateTable;
  95.     Function Rebuild: LongInt;
  96.     Function RecordCount: Longint;
  97.   published
  98.     property Active: Boolean read GetActive write SetActive default False;
  99.     Property AnsiConvert: Boolean read FAnsiConvert write SetAnsiConvert default True;
  100.     Property BrowserName: String read FBrowserName write SetBrowserName;
  101.     Property HeaderName: String read FHeaderName write SetHeaderName;
  102.     Property MyUnitName : TFileName read FUnitName write SetUnitName;
  103.     property TableName: TFileName read FTableName write SetTableName;
  104.     property RecordName: String read FRecordName write SetRecordName;
  105.     property IsamKeyProc: TStringList read FIsamKey write SetKeyProc;
  106.     property IsamRecord: TStringList read FRecord write SetRecord;
  107.     property Netz: NetSupportType read FNetz write SetNetz default NoNet;
  108.     property SaveModus: Boolean read FSaveModus write FSaveModus default False;
  109.     {$IFDEF CodeGen}
  110.     property SourceCreate: Boolean read FSourceCreate write SetSourceCreate default False;
  111.     {property SourceEditorCreate: Boolean read FEditorCreate write SetEditorCreate default False;}
  112.     {$ENDIF}
  113.     property AnzahlKeys: Byte read MaxKeys write MaxKeys default 1;
  114.     property IIDProc : TStringList read FIID write SetIIDProc;
  115.   end;
  116.  
  117. procedure Register;
  118.  
  119. implementation
  120.  
  121. Uses UToolDll, ExptIntf,
  122.      FvcBrows, IsamBrow, Proxies,
  123.      IsamEdit;
  124.  
  125. type
  126.   TIsamProperty = class(TStringProperty)
  127.   public
  128.     function GetAttributes: TPropertyAttributes; override;
  129.     procedure GetValueList(List: TStrings); virtual; abstract;
  130.     procedure GetValues(Proc: TGetStrProc); override;
  131.   end;
  132.  
  133. var FHandle: Longint;
  134.         
  135. function TIsamProperty.GetAttributes: TPropertyAttributes;
  136. begin
  137.   Result := [paValueList, paSortList, paMultiSelect, paReadOnly];
  138. end;
  139.  
  140. procedure TIsamProperty.GetValues(Proc: TGetStrProc);
  141. var
  142.   I: Integer;
  143.   Values: TStringList;
  144. begin
  145.   Values := TStringList.Create;
  146.   try
  147.     GetValueList(Values);
  148.     for I := 0 to Values.Count - 1 do Proc(Values[I]);
  149.   finally
  150.     Values.Free;
  151.   end;
  152. end;
  153.  
  154. Type
  155.   TIsamBrowserProperty = class(TIsamProperty)
  156.     procedure GetValueList(List: TStrings); override;
  157.   end;
  158.  
  159. procedure TIsamBrowserProperty.GetValueList(List: TStrings);
  160. var I: Integer;
  161.     Component: TComponent;
  162. begin
  163.   i:= 0;
  164.   While I < Designer.Form.ComponentCount do begin
  165.     Component := Designer.Form.Components[I];
  166.     if (Component is TIsamBrowser)
  167.     and (Component.Name <> '') then List.Add(Component.Name);
  168.     Inc(i);
  169.   end;
  170. end;
  171.  
  172. Type
  173.   TIsamHeaderProperty = class(TIsamProperty)
  174.     procedure GetValueList(List: TStrings); override;
  175.   end;
  176.  
  177. procedure TIsamHeaderProperty.GetValueList(List: TStrings);
  178. var I: Integer;
  179.     Component: TComponent;
  180. begin
  181.   i:= 0;
  182.   While I < Designer.Form.ComponentCount do begin
  183.     Component := Designer.Form.Components[I];
  184.     if (Component is THeader) and (Component.Name <> '') then List.Add(Component.Name);
  185.     Inc(i);
  186.   end;
  187. end;
  188.  
  189. constructor TIsamTable.Create(AOwner: TComponent);
  190. begin
  191.   inherited Create(AOwner);
  192.   FAnsiConvert:= True;
  193.   IFBPTR:= NIL;
  194.   RecSize:= 0;
  195.   KeyNo:= 1;
  196.   Ref:= 0;
  197.   Key_Proc:= NIL;
  198.   FTableName:= '';
  199.   FRecordName:= '';
  200.   MaxKeys := 1;
  201.   FIsamKey:= TStringList.Create;
  202.   FRecord:= Tstringlist.create;
  203.   FIID := TStringList.Create;
  204. {$Ifdef Test}
  205.   FIsamKey.Add('Function '+FRecordName+'KeyProc(Var Daten; KeyNr:Word): IsamKeyStr;');
  206.   FIsamKey.Add('var s : String;');
  207.   FIsamKey.Add('begin');
  208.   FIsamKey.Add('  s:= '+Chr(39)+Chr(39)+';');
  209.   FIsamKey.Add('  with '+FRecordName+'(Daten) do begin');
  210.   FIsamKey.Add('    case KeyNr of');
  211.   FIsamKey.Add('      1 : S:= '+Chr(39)+Chr(39)+';');
  212.   FIsamKey.Add('    End;');
  213.   FIsamkey.Add('  end;');
  214.   FIsamKey.Add('  KeyProc:= s;');
  215.   FIsamkey.Add('end;');
  216.   FIsamkey.Add('');
  217.  
  218.   FRecord.Add('Type');
  219.   FRecord.Add(FRecordName+' = Record');
  220.   FRecord.add('  Dummy : Longint;');
  221.   FRecord.add('end;');
  222. {$Endif}
  223.   if (csDesigning in ComponentState) then
  224.   if Toolservices <> NIL then
  225.   begin
  226.     FIsamKey.Add('Function '+FRecordName+'KeyProc(Var Daten; KeyNr:Word): IsamKeyStr;');
  227.     FIsamKey.Add('var s : String;');
  228.     FIsamKey.Add('begin');
  229.     FIsamKey.Add('  s:= '+Chr(39)+Chr(39)+';');
  230.     FIsamKey.Add('  with '+FRecordName+'(Daten) do begin');
  231.     FIsamKey.Add('    case KeyNr of');
  232.     FIsamKey.Add('      1 : S:= '+Chr(39)+Chr(39)+';');
  233.     FIsamKey.Add('    End;');
  234.     FIsamkey.Add('  end;');
  235.     FIsamKey.Add('  KeyProc:= s;');
  236.     FIsamkey.Add('end;');
  237.     FIsamkey.Add('');
  238.  
  239.     FRecord.Add('Type');
  240.     FRecord.Add(FRecordName+' = Record');
  241.     FRecord.add('  Dummy : Longint;');
  242.     FRecord.add('end;');
  243.   end;
  244.   if (csDesigning in ComponentState) then
  245.   if Toolservices <> NIL then
  246.   begin
  247.     if FUnitName = '' then
  248.     begin
  249.       {if not ToolServices.SaveProject then ErrorWindow('Project konnte nicht',
  250.                                                        'gespeichert werden');  }
  251.       FUnitName := ToolServices.GetUnitName(ToolServices.GetUnitCount);
  252.     end;
  253.   end;
  254.   if (csdesigning in componentstate) then begin
  255.     GetFHandle(FHandle);
  256.   end;
  257.   EditFormIdent:= '';
  258. end;
  259.  
  260. destructor TIsamTable.Destroy;
  261. begin
  262.   CheckInactive;
  263.   FIsamKey.Free;
  264.   FRecord.Free;
  265.   FIID.Free;
  266.   inherited Destroy;
  267. end;
  268.  
  269. procedure Register;
  270. begin
  271.   RegisterComponents('B-Tree Filer', [TIsamTable]);
  272.   RegisterPropertyEditor(TypeInfo(String), TIsamTable, 'BrowserName', TIsamBrowserProperty);
  273.   RegisterPropertyEditor(TypeInfo(String), TIsamTable, 'HeaderName', TIsamHeaderProperty);
  274. end;
  275.  
  276. Function TIsamTable.GetFormName(SList: TStringList): String;
  277. var S: Integer;
  278.     SStr: String;
  279.     Gefunden: Boolean;
  280. begin
  281.   S:= 0;
  282.   SStr:= '';
  283.   Gefunden:= False;
  284.   While (S < SList.Count) and (Gefunden = False) do begin
  285.     SStr:= UpperCase(SList[S]);
  286.     Strip(SStr);
  287.     if Pos('=CLASS',SStr) > 0 then Gefunden:= True
  288.     else Inc(S);
  289.   end;
  290.   If Gefunden then begin
  291.     SStr:= Copy(SStr,1,Pos('=CLASS',SStr)-1);
  292.   end
  293.   else SStr:= '';
  294.   Result:= SStr;
  295. end;
  296.  
  297. {$IFDEF CodeGen}
  298. Procedure GetArray(AStr: String; var Arr1,Arr2: Integer);
  299. var A1Str: String;
  300.     A1,A2,Code: Integer;
  301. begin
  302.   Arr1:= 1;
  303.   Arr2:= 1;
  304.   if (Pos('ARRAY[',AStr) > 0) and (Pos('CHAR',Astr) = 0) then begin
  305.     Delete(AStr,1,Pos('ARRAY[',AStr)+5);
  306.     if Pos(']',AStr) > 0 then begin
  307.       AStr:= Copy(AStr,1,Pos(']',AStr)-1);
  308.       if Pos('.',AStr) > 0 then begin
  309.         A1Str:= Copy(AStr,1,Pos('.',AStr)-1);
  310.         While (Pos('.',AStr) > 0) do Delete(AStr,1,Pos('.',AStr));
  311.         Strip(a1Str); Strip(AStr);
  312.         Val(A1Str,A1,Code);
  313.         Val(AStr,A2,Code);
  314.         if (A1 > 0) and (A2 > 0) then begin
  315.           Arr1:= A1;
  316.           Arr2:= A2;
  317.           if Arr1 > Arr2 then begin
  318.             A1:= Arr2;
  319.             Arr2:= Arr1;
  320.             Arr1:= A1;
  321.           end;
  322.         end;
  323.       end;
  324.     end;
  325.   end;
  326. end;
  327.  
  328. Function GetBrowserString(NStr: String; Arr: Integer): String;
  329. var S,FeldName,AStr: String;
  330. begin
  331.   S:= '';
  332.   FeldName:= Copy(NStr,1,Pos(':',NStr)-1);
  333.   Strip(FeldName);
  334.   if Arr > 0 then begin
  335.     Str(Arr,AStr);
  336.     FeldName:= FeldName+'['+AStr+']';
  337.   end;
  338.   if (Length(FeldName) > 0) and (Pos('DUMMY',NStr) = 0) and (Pos('MEMO',NStr) = 0) then begin
  339.     if Pos('WORD',NStr) > 0 then S:= 'DateStr('+FeldName+')'
  340.     else if Pos('INTEGER',NStr) > 0 then S:= 'IntStr('+FeldName+')'
  341.     else if Pos('BYTE',NStr) > 0 then S:= 'IntStr('+FeldName+')'
  342.     else if Pos('LONGINT',NStr) > 0 then S:= 'DateStr('+FeldName+')'
  343.     else if Pos('REAL',NStr) > 0 then S:= 'FormDezStr('+FeldName+',10,2)'
  344.     else S:= 'String_oem2ansi(Table.AnsiConvert,'+FeldName+')'
  345.   end;
  346.   GetBrowserString:= S;
  347. end;
  348.  
  349. Procedure TIsamTable.BrowRow(Var SListe: TStringList; VAR II:Integer);
  350. Var NStr   : String;
  351.     A,Feld,x,Arr1,Arr2: Integer;
  352.     BStr,FeldName: String;
  353.     s      : String;
  354. begin
  355.   S := '';
  356.   if IsamRecord.Count > 0 then begin
  357.     Feld:= 0;
  358.     For x:= 0 to IsamRecord.Count-1 do begin
  359.       NStr:= IsamRecord[x];
  360.       NStr:= Uppercase(NStr);
  361.       Strip(NStr);
  362.       if (Pos(':',NStr) > 0) then begin
  363.         GetArray(NStr,Arr1,Arr2);
  364.         if Arr1 = Arr2 then begin
  365.           A:= 0;
  366.           BStr:= GetBrowserString(NStr,A);
  367.           if BStr <> '' then begin
  368.             Inc(Feld);
  369.             SListe.Insert(ii,'      '+DezStr(Feld)+': s:= '+BStr+'+'+Chr(39)+'^'+Chr(39)+';');
  370.             Inc(ii);
  371.           end;
  372.         end
  373.         else begin
  374.           For a:= arr1 to Arr2 do begin
  375.             BStr:= GetBrowserString(NStr,A);
  376.             if BStr <> '' then begin
  377.               Inc(Feld);
  378.               SListe.Insert(ii,'      '+DezStr(Feld)+': s:= '+BStr+'+'+Chr(39)+'^'+Chr(39)+';');
  379.               Inc(ii);
  380.             end;
  381.           end;
  382.         end;
  383.       end;
  384.     end;
  385.   end;
  386. end;
  387. {$ENDIF}
  388.  
  389. Function TIsamTable.Check(Name:String; SS:TStringList) : Boolean;
  390. Var
  391.   SStr : String;
  392.   i    : word;
  393. begin
  394.   i := 0;
  395.   Name := UpperCase(Name);
  396.   Strip(Name);
  397.   Check := True;
  398.   if SS.Count > 0 then
  399.   repeat
  400.     SStr:= SS[i];
  401.     SStr:= Uppercase(SStr);
  402.     Strip(SStr);
  403.     if Pos(Name,SStr) > 0 then exit;
  404.     inc(i);
  405.   Until (i >= SS.Count);
  406.   Check := False;
  407. end;
  408.  
  409. Procedure TIsamTable.MySave;
  410. begin
  411.   if ToolServices <> NIL then begin
  412.     ToolServices.ReloadFile(FUnitName);
  413.     Toolservices.SaveFile(FUnitName);
  414.     if not ToolServices.SaveProject then begin
  415.       if Sprache = 1 then Errorwindow('Project could not be saved.','')
  416.       else ErrorWindow('Project konnte nicht','gespeichert werden.');
  417.     end;
  418.   end
  419.   else Errorwindow('TOOLSERVICES not assigned','');
  420. end;
  421.  
  422. Procedure TIsamTable.SetAnsiConvert(Const Value: Boolean);
  423. begin
  424.   FAnsiConvert:= Value;
  425. end;
  426.  
  427. Procedure TIsamTable.SetNetz(Value: NetSupportType);
  428. begin
  429.   FNetz:= Value;
  430. end;
  431.  
  432. Procedure TIsamTable.CheckInactive;
  433. begin
  434.   Active:= False;
  435. end;
  436.  
  437. function TIsamTable.GetActive: Boolean;
  438. begin
  439.   Result := (FActive = True);
  440. end;
  441.  
  442. Procedure TIsamTable.SetUnitName (Const Value:TFileName);
  443. begin
  444.   FunitName := Value;
  445.   if (csDesigning in ComponentState) then
  446.   if Toolservices <> NIL then
  447.   if Value <> FUnitName then
  448.   begin
  449.     if Sprache = 1 then begin
  450.       if Janein('Unitname changed, reload?','New: '+Value+' FUnitName: '+FUnitName) then
  451.       FUnitName := ToolServices.GetUnitName(ToolServices.GetUnitCount);
  452.     end
  453.     else begin
  454.       if Janein('Unitname geΣndert, neu einlesen?','Neu: '+Value+' FUnitName: '+FUnitName) then
  455.       FUnitName := ToolServices.GetUnitName(ToolServices.GetUnitCount);
  456.     end;
  457.   end;
  458. end;
  459.  
  460. procedure TIsamTable.SetActive(Value: Boolean);
  461. var AllesOk : Boolean;
  462. begin
  463.   AllesOk := True;
  464.   if FActive <> Value then begin
  465.     if Value then begin
  466.       if TableName <> '' then begin
  467.         if BtFileBlockIsOpen(IFBPtr) then begin
  468.           if Sprache = 1 then Errorwindow('Isamtable '+TableName,'is already opened')
  469.           else Errorwindow('Die Isamdatei: '+TableName,'ist bereits ge÷ffnet');
  470.           FActive := True;
  471.           Value := True;
  472.           AllesOk := False;
  473.         end else
  474.         if not Exist(TableName+'.DAT') then begin
  475.           if Sprache = 1 then Errorwindow('Isamtable '+TableName+' does not exist in the active path','')
  476.           else Errorwindow('Isamtabelle: '+TableName+' existiert nicht im angegebenen Directory !','');
  477.           FActive := False;
  478.           Value  := False;
  479.           AllesOk := False;
  480.           exit;
  481.         end else
  482.         begin
  483.           FActive := False;
  484.           InitIsam(Netz);
  485.           if RecSize = 0 then begin
  486.             if Sprache = 1 then Errorwindow('Isamtable will be opened local','')
  487.             else Errorwindow('Die Isamdatei wird lokal','ge÷ffnet');
  488.             BTOpenFileBlock(IFBPtr,TableName,False,False,SaveModus,False);
  489.             Diee;
  490.             if ISAMOK then FActive:= True else AllesOk := False;
  491.           end
  492.           else begin
  493.             if not(csDesigning in ComponentState) then begin
  494.               GetFHandle(FHandle);
  495.             end;
  496.             DateiOeffnen (IFBPtr,TableName,SaveModus,RecSize);
  497.             DIEE;
  498.             if ISAMOK then FActive:= True else AllesOk := False;
  499.           end;
  500.         end;
  501.       end
  502.       else begin
  503.         if Sprache = 1 then Errorwindow('no tablename assigned','')
  504.         else Errorwindow('kein Tabellenname angegeben','');
  505.       end;
  506.     end
  507.     else begin
  508.       if BtFileBlockIsOpen(IFBPtr) then begin
  509.         DateiSchliessen(IFBPtr);
  510.         DIEE;
  511.       end;
  512.       FActive:= False;
  513.       ExitIsam;
  514.     end;
  515.   end;
  516.   if not AllesOk then begin
  517.     if Sprache = 1 then Errorwindow('SETACTIVE-Error','Last ISAMERROR: '+DezStr(IsamError))
  518.     else Errorwindow('In SetActive ist ein Fehler aufgetreten',
  519.                       'letzter IsamError: '+DezStr(IsamError));
  520.   end;
  521. end;
  522.  
  523. procedure TIsamTable.SetTableName(const Value: TFileName);
  524. var S: String;
  525. begin
  526.   CheckInactive;
  527.   S:= Value;
  528.   if Pos('.',S) > 0 then begin
  529.     S:= Copy(S,1,Pos('.',S)-1);
  530.   end;
  531.   FTableName := S;
  532. end;
  533.  
  534. procedure TIsamTable.SetRecordName(Const Value: String);
  535. var i: Integer;
  536.     Gefunden: Boolean;
  537.     SStr: String;
  538. begin
  539.   if FRecordName <> Value then begin
  540.     FRecordName := Value;
  541.     if (csdesigning in componentstate) then begin
  542.       {if Owner is TForm then begin
  543.         if TForm(Owner).Designer <> NIL then TForm(Owner).Designer.Modified;
  544.       end;}
  545.       i:= 0;
  546.       Gefunden:= False;
  547.       While (i < FIsamKey.Count) and (Gefunden = False) do begin
  548.         SStr:= UpperCase(FIsamKey[i]);
  549.         Strip(SStr);
  550.         if (Pos('(DATEN)',SStr) > 0) then Gefunden:= True
  551.         else Inc(i);
  552.       end;
  553.       if Gefunden then begin
  554.         FIsamKey[i]:= '  with '+FRecordName+'(Daten) do begin';
  555.       end;
  556.       i:= 0;
  557.       Gefunden:= False;
  558.       While (i < FRecord.Count) and (Gefunden = False) do begin
  559.         SStr:= UpperCase(FRecord[i]);
  560.         Strip(SStr);
  561.         if (Pos('=RECORD',SStr) > 0) then Gefunden:= True
  562.         else Inc(i);
  563.       end;
  564.       if Gefunden then begin
  565.         FRecord[i]:= FRecordName+' = Record';
  566.       end;
  567.     end;
  568.   end;
  569. end;
  570.  
  571.  
  572. Procedure TIsamTable.SetRecord(Value: TStringList);
  573. begin
  574.   FRecord.Assign(Value);
  575. end;
  576.  
  577.  
  578. Procedure TIsamTable.SetBrowserName(Const Value: String);
  579. begin
  580.   if FBrowserName <> Value then
  581.   begin
  582.     FBrowserName:= Value;
  583.   end;
  584. end;
  585.  
  586.  
  587. Procedure TIsamTable.SetHeaderName(Const Value: String);
  588. begin
  589.   if FHeaderName <> Value then
  590.   begin
  591.     FHeaderName := Value;
  592.   end;
  593. end;
  594.  
  595. Procedure TIsamTable.SetKeyProc(Value: TStringList);
  596. begin
  597.   FIsamKey.Assign(Value);
  598. end;
  599.  
  600. Procedure TIsamTable.SetIIDProc(Value: TStringList);
  601. begin
  602.   FIID.Assign(Value);
  603. end;
  604.  
  605. {$IFDEF CodeGen}
  606. Procedure TIsamTable.Klammern_Loeschen(Var SourceStrings : TStringList);
  607. Var
  608.   I : Integer;
  609.   S : STring;
  610. begin
  611.   if BrowserName = '' then exit;
  612.   if HeaderName =  '' then exit;
  613.   I := 0;
  614.   Repeat
  615.     S:= SourceStrings[I];
  616.     if Pos('{}',S) > 0 then SourceStrings.Delete(i)
  617.     else Inc(I);
  618.   Until i >= SourceStrings.Count;
  619. end;
  620. {$ENDIF}
  621.  
  622. Procedure TIsamTable.Open;
  623. begin
  624.   Active:= True;
  625. end;
  626.  
  627. Procedure TIsamTable.Close;
  628. begin
  629.   CheckInactive;
  630. end;
  631.  
  632. {
  633.   FindFirst  = 0;
  634.   FindLast   = 1;
  635.   FindNext   = 2;
  636.   FindPrev   = 3;
  637.   FindALL    = 4;
  638. }
  639.  
  640. Procedure TIsamTable.First(var DATA, DUP);
  641. begin
  642.   if Active then begin
  643.     Nachbarkey(IFBPtr,KeyNo,Ref,Key,0);
  644.     DIEE;
  645.     if ISAMOK then begin
  646.       SatzLesen (IFBPtr,Ref,Data,Dup);
  647.       DIEE;
  648.     end;
  649.   end;
  650. end;
  651.  
  652. Procedure TIsamTable.CreateTable;
  653. Var Act : Boolean;
  654.     Txt1,Txt2: String;
  655. begin
  656.   Act := Active;
  657.   if Active then Close;
  658.   if Sprache = 1 then begin
  659.     Txt1:= 'Table '+TableName+' already exists.';
  660.     Txt2:= 'overwrite ?';
  661.   end
  662.   else begin
  663.     Txt1:= 'IsamTabelle '+TableName+' existiert schon.';
  664.     Txt2:= '▄berschreiben ?';
  665.   end;
  666.   if exist(TableName+'.Dat') then if not Janein(Txt1,Txt2) then
  667.   begin
  668.     if Act then Open;
  669.     exit;
  670.   end;
  671.   InitIsam(Netz);
  672.   if RecSize = 0 then begin
  673.     if Sprache = 1 then Errorwindow('No recordsize assigned','')
  674.     else Errorwindow('Recordgr÷▀e ist nicht angegeben','');
  675.   end
  676.   else begin
  677.     BTCREATEFileBlock(TableName,RecSize, MaxKeys, IID);
  678.     DIEE;
  679.   end;
  680.   ExitIsam;
  681.   if Act then Open;
  682. end;
  683.  
  684. {$F+}
  685. Procedure DisplayRebuildInfo (     KeyNr   : Integer;
  686.                                    NrRead,
  687.                                    NrWrite : LongInt;
  688.                                Var DatS;
  689.                                    Len     : Word );
  690.  
  691. Begin
  692.   Waitwindow('KeyNr.: '+DezStr(KeyNr),
  693.              'NrRead: '+DezStr(NrRead)+' NrWrite: '+DezStr(NrWrite));
  694. End;
  695. {$F-}
  696.  
  697. Function TIsamTable.Rebuild: LongInt;
  698. Const
  699.   MsgFileCreated : Boolean = True;
  700. Var Act: Boolean;
  701. begin
  702.   if TableName = '' then begin
  703.     if Sprache = 1 then Errorwindow('No tablename assigned','')
  704.     else Errorwindow('Tabellenname wurde nicht angegeben','')
  705.   end
  706.   else begin
  707.     Act:= Active;
  708.     if Active then Close;
  709.     if Sprache = 1 then WaitWindow('Reorg starts','')
  710.     else WaitWindow('Reorg beginnt','');
  711.     InitIsam(Netz);
  712.     IsamReXUserProcPtr := @DisplayRebuildInfo;
  713.     ReIndexFileBlock (TableName,
  714.                       MaxKeys,
  715.                       IID ,
  716.                       False,
  717.                       Key_Proc,
  718.                       False,
  719.                       MsgFileCreated,
  720.                       BTNoCharConvert,
  721.                       Nil);
  722.     ExitIsam;
  723.     CloseWait;
  724.     if Act then Open;
  725.   end;
  726.   Rebuild := IsamError;
  727. end;
  728.  
  729. Procedure TIsamTable.Insert(var DATA, DUP);
  730. begin
  731.   if Active then begin
  732.     SatzAnlegen (IFBPtr,Data,Key_Proc);
  733.     DIEE;
  734.     Get(DATA,DUP);
  735.   end;
  736. end;
  737.  
  738. Procedure TIsamTable.Append(var DATA, DUP);
  739. begin
  740.   if Active then begin
  741.     SatzAnlegen (IFBPtr,Data,Key_Proc);
  742.     DIEE;
  743.     Get(DATA,DUP);
  744.   end;
  745. end;
  746.  
  747. Procedure TIsamTable.UpdateRecord(var DATA, DUP);
  748. var Ok: Boolean;
  749. begin
  750.   if Active then begin
  751.     SatzAendern(IFBPtr,Ref,DATA,DUP,Key_Proc,Ok);
  752.     DIEE;
  753.     Get(DATA,DUP);
  754.   end;
  755. end;
  756.  
  757. Procedure TIsamTable.Get(var DATA, DUP);
  758. begin
  759.   if Active then begin
  760.     SatzLesen (IFBPtr,Ref,Data,Dup);
  761.     DIEE;
  762.     Key:= Key_Proc(DATA,KeyNo);
  763.   end;
  764. end;
  765.  
  766. Procedure TIsamTable.Last(var DATA, DUP);
  767. begin
  768.   if Active then begin
  769.     Nachbarkey(IFBPtr,KeyNo,Ref,Key,1);
  770.     DIEE;
  771.     if ISAMOK then begin
  772.       SatzLesen (IFBPtr,Ref,Data,Dup);
  773.       DIEE;
  774.     end;
  775.   end;
  776. end;
  777.  
  778. Procedure TIsamTable.ClearFields(var DATA, DUP);
  779. begin
  780.   if Active then begin
  781.     Fillchar(Data,Sizeof(Data),0);
  782.     Fillchar(Dup,Sizeof(Dup),0);
  783.   end;
  784. end;
  785.  
  786. Procedure TIsamTable.Delete(var DATA, DUP);
  787. Var ok,
  788.     Found : Boolean;
  789.     Key1  : ISamKeyStr;
  790.     Txt1  : String;
  791. begin
  792.   if Active then begin
  793.     Key1 := Key_Proc(Data,KeyNo);
  794.     KeySuchen (IFBPtr,KeyNo,Ref,Key1,Found);
  795.     Diee;
  796.     if Found then begin
  797.       if Sprache = 1 then Txt1:= 'Delete '+Key1+' ?'
  798.       else Txt1:= 'Datensatz '+Key1+' l÷schen ?';
  799.       if Janein(Txt1,'') then begin
  800.         Satzloeschen(IFBPtr,Ref,Dup,Key_Proc,OK);
  801.         DIEE;
  802.       end;
  803.     end else begin
  804.       if Sprache = 1 then Errorwindow('Record not found','')
  805.       else Errorwindow('DatenSatz nicht gefunden!','');
  806.     end;
  807.   end
  808.   else Errorwindow('Tabelle ist nicht aktiv','');
  809. end;
  810.  
  811. Procedure TIsamTable.Next(var DATA, DUP);
  812. begin
  813.   if Active then begin
  814.     Nachbarkey(IFBPtr,KeyNo,Ref,Key,2);
  815.     DIEE;
  816.     if ISAMOK then begin
  817.       SatzLesen (IFBPtr,Ref,Data,Dup);
  818.       DIEE;
  819.     end;
  820.   end;
  821. end;
  822.  
  823. Function TIsamTable.FindKey(Var Data,Dup;var Key1 : IsamKeyStr) : Boolean;
  824. Var Found : Boolean;
  825. begin
  826.   Found := False;
  827.   if Active then begin
  828.     KeySuchen (IFBPtr,KeyNo,Ref,Key1,Found);
  829.     Diee;
  830.     if Found then
  831.     begin
  832.       SatzLesen (IFBPtr,Ref,Data,Dup);
  833.       DIEE;
  834.       Key1:= Key_Proc(Data,KeyNo);
  835.       Key:= Key1;
  836.     end;
  837.   end;
  838.   FindKey := Found;
  839. end;
  840.  
  841. Function TIsamTable.FindNearest(Var Data,Dup; Key1 : IsamKeyStr) : Boolean;
  842. Var Found : Boolean;
  843. begin
  844.   Found := False;
  845.   if Active then begin
  846.     KeySuchen (IFBPtr,KeyNo,Ref,Key1,Found);
  847.     Diee;
  848.     SatzLesen (IFBPtr,Ref,Data,Dup);
  849.     DIEE;
  850.     Found := True;
  851.   end;
  852.   FindNearest := Found;
  853. end;
  854.  
  855. Procedure TIsamTable.Prior(var Data,Dup);
  856. begin
  857.   if Active then begin
  858.     Nachbarkey(IFBPtr,KeyNo,Ref,Key,3);
  859.     DIEE;
  860.     if ISAMOK then begin
  861.       SatzLesen (IFBPtr,Ref,Data,Dup);
  862.       DIEE;
  863.     end;
  864.   end;
  865. end;
  866.  
  867. Function TIsamTable.RecordCount: Longint;
  868. begin
  869.   if IFBPTR <> NIL then Result:= BtUsedRecs(IFBPtr)
  870.   else Result:= 0;
  871. end;
  872.  
  873. {$IFDEF CodeGen}
  874. Procedure TIsamTable.Uses_Einfuegen(var SourceStrings: TStringList);
  875. {ok}
  876. var SrceStr,SStr: String;
  877.     Gef1,Gef2,Gef3: Boolean;
  878.     S : Integer;
  879. begin
  880.   S:= 0;
  881.   Gef1:= False;
  882.   Gef2:= False;
  883.   Gef3:= False;
  884.   Repeat
  885.     SrceStr:= SourceStrings[S];
  886.     SStr:= Uppercase(SrceStr);
  887.     Strip(SStr);
  888.     Inc(S);
  889.   Until (Pos('USES',SStr) > 0) or (S >= SourceStrings.Count);
  890.   if Pos('USES',SStr) > 0 then begin
  891.     Repeat
  892.       SrceStr:= SourceStrings[S];
  893.       SStr:= Uppercase(SrceStr);
  894.       Strip(SStr);
  895.       if Pos('FILER',SStr) > 0 then Gef1:= True;
  896.       if Pos('UUSEISAM',SStr) > 0 then Gef2:= True;
  897.       if (Pos('LOWBROWS',SStr) > 0) or (BrowserName = '') then Gef3:= True;
  898.       Inc(S);
  899.     Until (Pos(';',SStr) > 0) or (S >= SourceStrings.Count);
  900.     Dec(S);
  901.     if Gef1 = False then begin
  902.       SrceStr:= SourceStrings[S];
  903.       System.Delete(SrceStr,Length(SrceStr),1);
  904.       SrceStr:= SrceStr + ','+#13+#10+'  Filer;';
  905.       SourceStrings[S]:= SrceStr;
  906.     end;
  907.     if Gef2 = False then begin
  908.       SrceStr:= SourceStrings[S];
  909.       System.Delete(SrceStr,Length(SrceStr),1);
  910.       SrceStr:= SrceStr + ', UUseIsam;';
  911.       SourceStrings[S]:= SrceStr;
  912.     end;
  913.     if Gef3 = False then begin
  914.       SrceStr:= SourceStrings[S];
  915.       System.Delete(SrceStr,Length(SrceStr),1);
  916.       SrceStr:= SrceStr + ', LowBrows;';
  917.       SourceStrings[S]:= SrceStr;
  918.     end;
  919.   end;
  920.   S := 0;
  921.   Repeat
  922.     SrceStr:= SourceStrings[S];
  923.     SStr:= Uppercase(SrceStr);
  924.     Strip(SStr);
  925.     Inc(S);
  926.   Until (Pos('IMPLEMENTATION',SStr) > 0) or (S >= SourceStrings.Count);
  927.   Repeat
  928.     SrceStr:= SourceStrings[S];
  929.     SStr:= Uppercase(SrceStr);
  930.     Strip(SStr);
  931.     Inc(S);
  932.   Until (Pos('USES',SStr) > 0) or (Pos('{$R*.DFM}',SStr) > 0) or (S >= SourceStrings.Count);
  933.   if Pos('USES',SStr) = 0 then begin
  934.     Dec(S);
  935.     SrceStr:= 'Uses SysUtils, UToolDll, Isam_Key, IsamSuch;';
  936.     SourceStrings.Insert(S,SrceStr);
  937.   end
  938.   else begin
  939.     Gef1:= False;
  940.     Dec(S);
  941.     if Pos('UTOOLDLL',SStr) > 0 then Gef1:= True;
  942.     if Gef1 = False then begin
  943.       SrceStr:= SourceStrings[S];
  944.       System.Delete(SrceStr,Length(SrceStr),1);
  945.       SrceStr:= SrceStr + ', UTOOLDLL;';
  946.       SourceStrings[S]:= SrceStr;
  947.     end;
  948.   end;
  949. end;
  950.  
  951. Procedure TIsamTable.Record_Einfuegen(var SourceStrings : TStringList);
  952. {ok}
  953. var RStr,RecStr,SStr,SrceStr: String;
  954.     S,R : Integer;
  955.     RecStrings : TStringList;
  956. begin
  957.   S := 0;
  958.   R := 0;
  959.   if FRecord = Nil then exit;
  960.   RecStrings := TStringList.Create;
  961.   RecStrings.Assign(FRecord);
  962.   R := 0;
  963.   if RecStrings.Count > 0 then
  964.   begin
  965.     Repeat
  966.       RStr := RecStrings[R];
  967.       RStr := UpperCase(RStr);
  968.       if Pos(UpperCase(FRecordName),RStr) = 0 then RecStrings.Delete(R)
  969.       else inc(R);
  970.     Until (Pos(UpperCase(FRecordName),RStr) > 0) or (R >= RecStrings.Count);
  971.   end else
  972.   begin
  973.     RecStrings.Free;
  974.     exit;
  975.   end;
  976.   R := 0;
  977.   if RecStrings.Count > 0 then begin
  978.     Repeat
  979.       RStr := RecStrings[R];
  980.       RStr := UpperCase(RStr);
  981.       if Pos(UpperCase(FRecordName),RStr) = 0 then RecStrings.Delete(R) else
  982.       inc(R);
  983.     Until (Pos(UpperCase(FRecordName),RStr) > 0) or (R >= RecStrings.Count);
  984.   end;
  985.   Repeat
  986.     {Zuersteinmal l÷schen}
  987.     SrceStr:= SourceStrings[S];
  988.     SStr:= Uppercase(SrceStr);
  989.     Strip(SStr);
  990.     if Pos(Uppercase(FRecordName)+'=RECORD',SStr) > 0 then
  991.     begin
  992.       if Sprache = 1 then SErrorwindow(FRECORDNAME+' deleted','')
  993.       else Serrorwindow(FRECORDNAME+' wird gel÷scht','');
  994.       Repeat
  995.         SourceStrings.Delete(S);
  996.         SrceStr:= SourceStrings[S];
  997.         SStr:= Uppercase(SrceStr);
  998.         Strip(SStr);
  999.       Until(Pos('END;',SStr) > 0) or (S >= SourceStrings.Count);
  1000.       if (Pos('END;',SStr) > 0) then SourceStrings.Delete(S);
  1001.     end;
  1002.     Inc(S);
  1003.   Until (Pos('=CLASS',SStr) > 0) or (S >= SourceStrings.Count);
  1004.   S := 0;
  1005.   Repeat
  1006.     SrceStr:= SourceStrings[S];
  1007.     SStr:= Uppercase(SrceStr);
  1008.     Strip(SStr);
  1009.     Inc(S);
  1010.   Until (Pos('=CLASS',SStr) > 0) or (S >= SourceStrings.Count);
  1011.  
  1012.   if (Pos('=CLASS',SStr) > 0) and (RecStrings.Count > 0) then begin
  1013.     if Sprache = 1 then SErrorwindow('Create new record ',FRecordName)
  1014.     else SErrorwindow('Record neu aufbauen',FrecordName);
  1015.     Dec(S);
  1016.     Dec(R);
  1017.     Repeat
  1018.       RecStr := RecStrings[R];
  1019.       if Pos('RECORD',UpperCase(RecStr)) = 0 then
  1020.       RecStr:= Copy(RecStr,1,Pos(';',RecStr));
  1021.       RecStr := Delspace(RecStr);
  1022.       RecStr := '  '+RecStr;
  1023.       RStr:= Uppercase(RecStr);
  1024.       Strip(RStr);
  1025.       Inc(R);
  1026.       if Delspace(RecStr) <> '' then begin
  1027.         SourceStrings.Insert(S,RecStr);
  1028.         Inc(S);
  1029.       end;
  1030.     Until (Pos('END;',RStr) > 0) or (R >= RecStrings.Count);
  1031.   end;
  1032.   RecStrings.Free;
  1033. end;
  1034.  
  1035. Procedure TIsamTable.Data_Einfuegen(var SourceStrings: TStringList);
  1036. {ok}
  1037. var SStr,
  1038.     SrceStr: String;
  1039.     S      : Integer;
  1040. begin
  1041.   S:= 0;
  1042.  
  1043.   Repeat
  1044.     SrceStr:= SourceStrings[S];
  1045.     SStr:= Uppercase(SrceStr);
  1046.     Strip(SStr);
  1047.     Inc(S);
  1048.   Until (Pos('PUBLIC',SStr) > 0) or (S >= SourceStrings.Count);
  1049.   Repeat
  1050.     SrceStr:= SourceStrings[S];
  1051.     SStr:= Uppercase(SrceStr);
  1052.     Strip(SStr);
  1053.     if (Pos(UpperCase(RECORDNAME+'DATEN'),SStr) > 0) or
  1054.        (Pos(UpperCase(RECORDNAME+'DUP'),SStr) > 0)
  1055.     then
  1056.     begin
  1057.       SourceStrings.Delete(S);
  1058.       if Sprache = 1 then SErrorwindow(RECORDNAME+' deleted','')
  1059.       else Serrorwindow(RECORDNAME+' wird gel÷scht','DAT: und DUP:');
  1060.     end
  1061.     else
  1062.     Inc(S);
  1063.   Until (Pos('PROCEDURE',SStr) > 0) or
  1064.         (Pos('PROPERTY',SStr) > 0) or
  1065.         (Pos('FUNCTION',SStr) > 0) or
  1066.         (Pos('END;',SStr) > 0) or
  1067.         (S >= SourceStrings.Count);
  1068.   Dec(S);
  1069.   SStr:= '    '+RecordName+'Daten: '+FRecordName+';';
  1070.   SourceStrings.Insert(S,SStr);
  1071.   SStr:= '    '+RecordName+'Dup : '+FRecordName+';';
  1072.   SourceStrings.Insert(S,SStr);
  1073. end;
  1074.  
  1075.  
  1076. Procedure TIsamTable.Key_Deklaration_Einfuegen(var SourceStrings: TStringList);
  1077. {ok}
  1078. var KStr,KeyStr,
  1079.     SStr,SrceStr: String;
  1080.     KeyStrings  : TStringList;
  1081.     R,S         : Integer;
  1082. begin
  1083.   if FIsamKey = Nil then exit;
  1084.   {Nach Public und darauf folgendem End suchen}
  1085.   S := 0;
  1086.   Repeat
  1087.     SrceStr:= SourceStrings[S];
  1088.     SStr:= Uppercase(SrceStr);
  1089.     Strip(SStr);
  1090.     Inc(S);
  1091.   Until (Pos('PUBLIC',SStr) > 0) or (S >= SourceStrings.Count);
  1092.   Repeat
  1093.     SrceStr:= SourceStrings[S];
  1094.     SStr:= Uppercase(SrceStr);
  1095.     Strip(SStr);
  1096.     Inc(S);
  1097.   Until (Pos('END;',SStr) > 0) or (S >= SourceStrings.Count);
  1098.   Dec(S);
  1099.  
  1100.   {Wenn die Keyproc besteht, dann l÷schen}
  1101.   Repeat
  1102.     SrceStr:= SourceStrings[S];
  1103.     SStr:= Uppercase(SrceStr);
  1104.     Strip(SStr);
  1105.     if (Pos(UpperCase(RecordName)+'KEYPROC(',SStr) > 0) then
  1106.     begin
  1107.       SourceStrings.Delete(S);
  1108.       if Sprache = 1 then SErrorwindow('Delete KEYPROC-Declaration','')
  1109.       else SErrorwindow('KeyprocDeklaration wird gel÷scht','');
  1110.     end else Inc(S);
  1111.   Until (Pos('IMPLEMENTATION',SStr) > 0) or (S >= SourceStrings.Count);
  1112.  
  1113.   {Nun wieder von vorne und die KeyProc eintragen}
  1114.   S := 0;
  1115.   Repeat
  1116.     SrceStr:= SourceStrings[S];
  1117.     SStr:= Uppercase(SrceStr);
  1118.     Strip(SStr);
  1119.     Inc(S);
  1120.   Until (Pos('PUBLIC',SStr) > 0) or (S >= SourceStrings.Count);
  1121.   Repeat
  1122.     SrceStr:= SourceStrings[S];
  1123.     SStr:= Uppercase(SrceStr);
  1124.     Strip(SStr);
  1125.     Inc(S);
  1126.   Until (Pos('END;',SStr) > 0) or (S >= SourceStrings.Count);
  1127.   SourceStrings.Insert(S,'Function '+RecordName+'KeyProc(Var Daten; KeyNr:Word): IsamKeyStr; FAR;');
  1128.   inc(S);
  1129.   if Sprache = 1 then SErrorwindow('KEYPROC-declaration added','')
  1130.   else SErrorwindow('KeyprocDeklaration wird hinzugefⁿgt','');
  1131. end;
  1132.  
  1133. Procedure TIsamTable.GetFeldProc_Einfuegen(var SourceStrings : TStringList);
  1134. var KStr,KeyStr,
  1135.     SStr,SrceStr: String;
  1136.     KeyStrings  : TStringList;
  1137.     R,S         : Integer;
  1138.     Gefunden    : Boolean;
  1139. begin
  1140.   R := 0;
  1141.   if IsamRecord.Count < 1 then begin
  1142.     if Sprache = 1 then Errorwindow('no record defined','')
  1143.     else Errorwindow('Kein Record definiert','');
  1144.     Exit;
  1145.   end;
  1146.   S := 0;
  1147.   {zuerst wird bis nach Implementation gesucht (*.DFM)}
  1148.   Repeat
  1149.     SrceStr:= SourceStrings[S];
  1150.     SStr:= Uppercase(SrceStr);
  1151.     Strip(SStr);
  1152.     Inc(S);
  1153.   Until (Pos('{$R*.DFM',SStr) > 0) or (S >= SourceStrings.Count);
  1154.   Dec(S);
  1155.  
  1156.   Repeat
  1157.     SrceStr:= SourceStrings[S];
  1158.     SStr:= Uppercase(SrceStr);
  1159.     Strip(SStr);
  1160.     Inc(S);
  1161.   Until (Pos(UpperCase(RecordName)+'GETFELDPROC(',SStr) > 0) or (S >= SourceStrings.Count);
  1162.   if (Pos(UpperCase(RecordName)+'GETFELDPROC(',SStr) > 0) then
  1163.   begin
  1164.     if Sprache = 1 then SErrorwindow('GetFeldProc will be deleted','')
  1165.     else SErrorwindow('GetFeldProc wird gel÷scht.','');
  1166.     Dec(S);
  1167.     Repeat
  1168.       SourceStrings.Delete(S);
  1169.       SrceStr:= SourceStrings[S];
  1170.       SStr:= Uppercase(SrceStr);
  1171.       Strip(SStr);
  1172.     Until (Pos('RESULT',SStr) > 0)
  1173.           or(S >= SourceStrings.Count);
  1174.     SourceStrings.Delete(S);
  1175.     SourceStrings.Delete(S); {Das ist das end; der GetFeldProc}
  1176.   end else
  1177.   begin
  1178.     {wenn GetFeldProc nicht gefunden}
  1179.     S := 0;
  1180.     Repeat
  1181.       SrceStr:= SourceStrings[S];
  1182.       SStr:= Uppercase(SrceStr);
  1183.       Strip(SStr);
  1184.       inc(S);
  1185.     Until (S >= SourceStrings.Count)
  1186.           or (Pos(Uppercase('{$R*.DFM'),SStr) > 0);
  1187.     Dec(s);
  1188.     SourceStrings.Insert(S,' ');
  1189.     Inc(S);
  1190.   end;
  1191.   R:= 0;
  1192.   if Sprache = 1 then SErrorwindow('GetFeldProc added','')
  1193.   else SErrorwindow('GetFeldProc wird eingetragen.','');
  1194.   SourceStrings.Insert(S,'Function '+RecordName+'GetFeldProc(Feld: Integer; Table: TIsamTable; var DATA): String; far;');
  1195.   Inc(S);
  1196.   SourceStrings.Insert(S,'var S: String;');
  1197.   Inc(S);
  1198.   SourceStrings.Insert(S,'begin');
  1199.   Inc(S);
  1200.   SourceStrings.Insert(S,'  S:= '+Chr(39)+Chr(39)+';');
  1201.   Inc(S);
  1202.   SourceStrings.Insert(S,'  With '+RECORDName+'(Data) do begin');
  1203.   Inc(S);
  1204.   SourceStrings.Insert(S,'    Case Feld of');
  1205.   Inc(S);
  1206.   BrowRow(SourceStrings,S);
  1207.   SourceStrings.Insert(S,'    end;');
  1208.   Inc(S);
  1209.   SourceStrings.Insert(S,'  end;');
  1210.   Inc(S);
  1211.   SourceStrings.Insert(S,'  Result:= S;');
  1212.   Inc(S);
  1213.   SourceStrings.Insert(S,'end;');
  1214.   Inc(S);
  1215. end;
  1216.  
  1217. Procedure TIsamTable.Key_Proc_Einfuegen(var SourceStrings : TStringList);
  1218. {ok noch nicht ganz}
  1219. var KStr,KeyStr,
  1220.     SStr,SrceStr: String;
  1221.     KeyStrings  : TStringList;
  1222.     R,S         : Integer;
  1223.     Gefunden    : Boolean;
  1224. begin
  1225.   R := 0;
  1226.   S := 0;
  1227.   if FIsamKey = Nil then exit;
  1228.   KeyStrings := TStringList.Create;
  1229.   KeyStrings.Assign(FIsamKey);
  1230.   if KeyStrings.Count = 0 then exit;
  1231.  
  1232.   {zuerst wird bis nach Implementation gesucht (*.DFM)}
  1233.  
  1234.   Repeat
  1235.     SrceStr:= SourceStrings[S];
  1236.     SStr:= Uppercase(SrceStr);
  1237.     Strip(SStr);
  1238.     Inc(S);
  1239.   Until (Pos('{$R*.DFM',SStr) > 0) or (S >= SourceStrings.Count);
  1240.   Dec(S);
  1241.  
  1242.   Repeat
  1243.     SrceStr:= SourceStrings[S];
  1244.     SStr:= Uppercase(SrceStr);
  1245.     Strip(SStr);
  1246.     Inc(S);
  1247.   Until (Pos(UpperCase(RecordName)+'KEYPROC(',SStr) > 0) or (S >= SourceStrings.Count);
  1248.   if (Pos(UpperCase(RecordName)+'KEYPROC(',SStr) > 0) then
  1249.   begin
  1250.     if Sprache = 1 then SErrorwindow('KeyProc will be deleted','')
  1251.     else SErrorwindow('KeyProc wird gel÷scht.','');
  1252.     Dec(S);
  1253.     Repeat
  1254.       SourceStrings.Delete(S);
  1255.       SrceStr:= SourceStrings[S];
  1256.       SStr:= Uppercase(SrceStr);
  1257.       Strip(SStr);
  1258.     Until (Pos(Uppercase(RecordName+'KEYPROC'),SStr) > 0)
  1259.           or(S >= SourceStrings.Count);
  1260.     SourceStrings.Delete(S);
  1261.     SourceStrings.Delete(S); {Das ist das end; der Keyproc}
  1262.   end else
  1263.   begin
  1264.     {wenn KeyProc nicht gefunden}
  1265.     S := 0;
  1266.     Repeat
  1267.       SrceStr:= SourceStrings[S];
  1268.       SStr:= Uppercase(SrceStr);
  1269.       Strip(SStr);
  1270.       inc(S);
  1271.     Until (S >= SourceStrings.Count)
  1272.           or (Pos(Uppercase('END.'),SStr) > 0);
  1273.     Dec(s);
  1274.     Dec(s);
  1275.   end;
  1276.   R:= 0;
  1277.   if Sprache = 1 then SErrorwindow('KeyProc will be added','')
  1278.   else SErrorwindow('KeyProc wird eingetragen.','');
  1279.   Repeat
  1280.     KeyStr:= KeyStrings[R];
  1281.     KStr:= Uppercase(KeyStr);
  1282.     if Pos('FUNCTION ',KStr) > 0 then begin
  1283.       SStr:= KStr;
  1284.       System.Delete(SStr,Pos('FUNCTION ',SStr),9);
  1285.       if Pos('KEYPROC',SStr) > 0 then System.Delete(SStr,1,Pos('KEYPROC',SStr)-1);
  1286.       KeyStr:= 'Function '+RecordName+SStr;
  1287.     end;
  1288.     if Pos('(DATEN)',KStr) > 0 then begin
  1289.       SStr:= KStr;
  1290.       System.Delete(SStr,1,Pos('(DATEN)',SStr)-1);
  1291.       KeyStr:= '  With '+FRecordName+'(Daten) do begin';
  1292.     end;
  1293.     if Pos('KEYPROC:=',KStr) > 0 then begin
  1294.       SStr:= KStr;
  1295.       System.Delete(SStr,1,Pos('KEYPROC:=',SStr)-1);
  1296.       KeyStr:= '  '+RecordName+SStr;
  1297.     end;
  1298.     SourceStrings.Insert(S,KeyStr);
  1299.     Inc(S);
  1300.     Inc(R);
  1301.   Until R >= KeyStrings.Count;
  1302. end;
  1303.  
  1304. Procedure TIsamTable.FormCreate_Einfuegen(var SourceStrings: TStringList);
  1305. {ok}
  1306. var SrceStr,SStr: String;
  1307.     Gefunden1,
  1308.     Gefunden2,
  1309.     Gefunden3    : Boolean;
  1310.     i           : Byte;
  1311.     S           : Integer;
  1312.     FormName    : String;
  1313. begin
  1314.   Gefunden1 := Check('Procedure FormCreate(Sender',SourceStrings) ;
  1315.   Gefunden2 := Check('Procedure FormResize(Sender',SourceStrings) ;
  1316.   Gefunden3 := Check('Procedure FormShow(Sender',SourceStrings) ;
  1317.   FormName:= GetFormName(SourceStrings);
  1318.   S:= 0;
  1319.   Gefunden1 := False;
  1320.   Repeat
  1321.     SrceStr:= SourceStrings[S];
  1322.     SStr:= Uppercase(SrceStr);
  1323.     Strip(SStr);
  1324.     if Pos('FORMCREATE',SStr) > 0 then Gefunden1:= True;
  1325.     Inc(S);
  1326.   Until (Pos('PRIVATE',SStr) > 0) or (S >= SourceStrings.Count);
  1327.   if S < SourceStrings.Count then begin
  1328.     if Gefunden1 = False then begin
  1329.       Dec(S);
  1330.       SourceStrings.Insert(S,'    Procedure FormCreate(Sender: TObject);');
  1331.       Inc(S);
  1332.     end;
  1333.     If Gefunden2 = False then begin
  1334.       if BrowserName <> '' then begin
  1335.         SourceStrings.Insert(S,'    Procedure FormResize(Sender: TObject);');
  1336.         Inc(S);
  1337.       end;
  1338.     end;
  1339.     if Gefunden3 = False then begin
  1340.       if BrowserName <> '' then begin
  1341.         SourceStrings.Insert(S,'    Procedure FormShow(Sender: TObject);');
  1342.         Inc(S);
  1343.       end;
  1344.     end;
  1345.     Repeat
  1346.       SrceStr:= SourceStrings[S];
  1347.       SStr:= Uppercase(SrceStr);
  1348.       Strip(SStr);
  1349.       Inc(S);
  1350.     Until (Pos('{$R*.DFM',SStr) > 0) or (S >= SourceStrings.Count);
  1351.   end;
  1352.   if S < SourceStrings.Count then begin
  1353.     Repeat
  1354.       SrceStr:= SourceStrings[S];
  1355.       SStr:= Uppercase(SrceStr);
  1356.       Strip(SStr);
  1357.       Inc(S);
  1358.     Until (Pos('FORMCREATE',SStr) > 0) or (S >= SourceStrings.Count);
  1359.   end;
  1360.   {Nun wird Formcreate eingetragen}
  1361.   if Pos('FORMCREATE',SStr) = 0 then
  1362.   begin
  1363.     Dec(S);
  1364.     SourceStrings.Insert(S,'Procedure '+FormName+'.FormCreate(Sender: TObject);');
  1365.     Inc(S);
  1366.     SourceStrings.Insert(S,'begin');
  1367.     Inc(S);
  1368.     SourceStrings.Insert(S,'{}'); {Damit Delphi mir das nicht wieder l÷scht}
  1369.     Inc(S);
  1370.     SourceStrings.Insert(S,'end;');
  1371.     Inc(S);
  1372.     SourceStrings.Insert(S,'');
  1373.     Inc(S);
  1374.     if Gefunden2 = False then begin
  1375.       if BrowserName <> '' then begin
  1376.         SourceStrings.Insert(S,'Procedure '+FormName+'.FormResize(Sender: TObject);');
  1377.         inc(S);
  1378.         SourceStrings.Insert(S,'begin');
  1379.         Inc(S);
  1380.         SourceStrings.Insert(S,'{}'); {Damit Delphi mir das nicht wieder l÷scht}
  1381.         Inc(S);
  1382.         SourceStrings.Insert(S,'end;');
  1383.         Inc(S);
  1384.         SourceStrings.Insert(S,'');
  1385.         Inc(S);
  1386.       end;
  1387.     end;
  1388.     If gefunden3 = False then begin
  1389.       if BrowserName <> '' then begin
  1390.         SourceStrings.Insert(S,'Procedure '+FormName+'.FormShow(Sender: TObject);');
  1391.         inc(S);
  1392.         SourceStrings.Insert(S,'begin');
  1393.         Inc(S);
  1394.         SourceStrings.Insert(S,'{}'); {Damit Delphi mir das nicht wieder l÷scht}
  1395.         Inc(S);
  1396.         SourceStrings.Insert(S,'end;');
  1397.         Inc(S);
  1398.         SourceStrings.Insert(S,'');
  1399.         Inc(S);
  1400.       end;
  1401.     end;
  1402.     if Sprache = 1 then SErrorwindow('Procedures Formcreate, FormShow, FormResize','added')
  1403.     else SErrorwindow('Proceduren Formcreate,FormShow,FormResize ','werden eingetragen.');
  1404.   end;
  1405. end;
  1406.  
  1407.  
  1408. Procedure TIsamTable.Formcreate_Fuellen(var SourceStrings: TStringList);
  1409. {ok}
  1410. Var
  1411.    S,R           : Integer;
  1412.    SrceStr, SStr,
  1413.    FormName      : String;
  1414.    IIDStr        : String;
  1415.    IIDStrings    : TStringList;
  1416.    Gefunden1,
  1417.    Gefunden2,
  1418.    Gefunden3,
  1419.    Gefunden4: Boolean;
  1420. begin
  1421.   Gefunden1 := Check('with '+UpperCase(NAME)+' do begin',SourceStrings);
  1422.   Gefunden2 := Check(BrowserName+'.OnBuildRow:=',SourceStrings);
  1423.   Gefunden3 := Check(BrowserName+'.BrowserHeader:=',SourceStrings);
  1424.   Gefunden4 := Check(HeaderName+'.OnSized:= '+HeaderName+'Sized;',SourceStrings);
  1425.   FormName:= GetFormName(SourceStrings);
  1426.   S := 0;
  1427.   {Formcreate-Rumpf wird gesucht}
  1428.   Repeat
  1429.    SrceStr:= SourceStrings[S];
  1430.    SStr:= Uppercase(SrceStr);
  1431.    Strip(SStr);
  1432.    Inc(S);
  1433.   Until (Pos('.FORMCREATE',SStr) > 0) or (S >= SourceStrings.Count);
  1434.  
  1435.   {Formcreate Begin wird gesucht}
  1436.   Dec(S);
  1437.   Repeat
  1438.     SrceStr:= SourceStrings[S];
  1439.     SStr:= Uppercase(SrceStr);
  1440.     Strip(SStr);
  1441.     Inc(S);
  1442.   Until (Pos('BEGIN',SStr) > 0) or (S >= SourceStrings.Count);
  1443.  
  1444.   if not Gefunden1 then
  1445.   begin
  1446.     if Sprache = 1 then SErrorwindow('KeyProc will be added to FORMCREATE','')
  1447.     else SErrorwindow('KeyProc wird in','Formcreate eingetragen');
  1448.     SourceStrings.Insert(S,'  with '+Name+' do begin');
  1449.     Inc(S);
  1450.     SourceStrings.Insert(S,'    Key_Proc :=  '+Recordname+'KEYPROC;');
  1451.     Inc(S);
  1452.     SourceStrings.Insert(S,'    Recsize:= Sizeof('+FRecordName+');');
  1453.     Inc(S);
  1454.     if FIID.Count > 0 then begin
  1455.       R := 0;
  1456.       Repeat
  1457.         IIDStr := FIID[R];
  1458.         inc(R);
  1459.         SourceStrings.Insert(S,'  '+IIDStr);
  1460.         Inc(S);
  1461.       Until R >=  FIID.Count;
  1462.     end;
  1463.     SourceStrings.Insert(S,'    Active:= True;');
  1464.     Inc(S);
  1465.     SourceStrings.Insert(S,'  end;');
  1466.     Inc(S);
  1467.   end;
  1468.   if not Gefunden2 then begin
  1469.     if BrowserName <> '' then begin
  1470.       if Sprache = 1 then SErrorwindow('OnBuildRow and ConnectLowBrowser',
  1471.                    'will be added to FORMCREATE')
  1472.       else SErrorwindow('OnbuildRow und ConnectLowBrowser',
  1473.                    'wird in Formcreate eingetragen');
  1474.       S := 0;
  1475.      {Formcreate-Rumpf wird gesucht}
  1476.       Repeat
  1477.         SrceStr:= SourceStrings[S];
  1478.         SStr:= Uppercase(SrceStr);
  1479.         Strip(SStr);
  1480.         Inc(S);
  1481.       Until (Pos('.FORMCREATE',SStr) > 0) or (S >= SourceStrings.Count);
  1482.       Repeat
  1483.         SrceStr:= SourceStrings[S];
  1484.         SStr:= Uppercase(SrceStr);
  1485.         Strip(SStr);
  1486.         Inc(S);
  1487.       Until (Pos('END;',SStr) > 0) or (S >= SourceStrings.Count);
  1488.       Dec(S);
  1489.       SourceStrings.Insert(S,'  if '+Name+'.Active then begin');
  1490.       Inc(S);
  1491.       SourceStrings.Insert(S,'    '+BrowserName+'.OnBuildRow:= '+BrowserName+'BuildRow;');
  1492.       Inc(S);
  1493.       SourceStrings.Insert(S,'    '+BrowserName+'.ConnectLowBrowser(New(PLowWinBrowser, Init(True, '+Name+'.IFBPTR,');
  1494.       Inc(S);
  1495.       SourceStrings.Insert(S,'         1, 50, 1, '+Chr(39)+Chr(39)+', '+Chr(39)+Chr(39)+', '+RecordName+'Daten, False )));');
  1496.       Inc(S);
  1497.       SourceStrings.Insert(S,'    '+BrowserName+'.SetAndUpdateBrowserScreen('+Chr(39)+Chr(39)+', 0);');
  1498.       Inc(S);
  1499.       SourceStrings.Insert(S,'  end;');
  1500.       Inc(S);
  1501.     end;
  1502.   end;
  1503.   if not Gefunden3  then begin
  1504.     if (BrowserName <> '') and (HeaderName <> '') then begin
  1505.       if Sprache = 1 then SErrorwindow('BrowserHeader will be added to FORMCREATE','')
  1506.       else SErrorwindow('BrowserHeader','wird in Formcreate eingetragen');
  1507.       S := 0;
  1508.      {Formcreate-Rumpf wird gesucht}
  1509.       Repeat
  1510.         SrceStr:= SourceStrings[S];
  1511.         SStr:= Uppercase(SrceStr);
  1512.         Strip(SStr);
  1513.         Inc(S);
  1514.       Until (Pos('.FORMCREATE',SStr) > 0) or (S >= SourceStrings.Count);
  1515.       Repeat
  1516.         SrceStr:= SourceStrings[S];
  1517.         SStr:= Uppercase(SrceStr);
  1518.         Strip(SStr);
  1519.         Inc(S);
  1520.       Until (Pos('END;',SStr) > 0) or (S >= SourceStrings.Count);
  1521.       Dec(S);
  1522.       SourceStrings.Insert(S,'  '+BrowserName+'.BrowserHeader:= '+HeaderName+';');
  1523.       Inc(S);
  1524.     end;
  1525.   end;
  1526.   if not Gefunden4 then begin
  1527.     if HeaderName <> '' then begin
  1528.       S := 0;
  1529.      {Formcreate-Rumpf wird gesucht}
  1530.       Repeat
  1531.         SrceStr:= SourceStrings[S];
  1532.         SStr:= Uppercase(SrceStr);
  1533.         Strip(SStr);
  1534.         Inc(S);
  1535.       Until (Pos('.FORMCREATE',SStr) > 0) or (S >= SourceStrings.Count);
  1536.       Repeat
  1537.         SrceStr:= SourceStrings[S];
  1538.         SStr:= Uppercase(SrceStr);
  1539.         Strip(SStr);
  1540.         Inc(S);
  1541.       Until (Pos('END;',SStr) > 0) or (S >= SourceStrings.Count);
  1542.       Dec(S);
  1543.       SourceStrings.Insert(S,'  '+HeaderName+'.OnSized:= '+HeaderName+'Sized;');
  1544.       Inc(S);
  1545.     end;
  1546.   end;
  1547. end;
  1548.  
  1549. Procedure TIsamTable.FormResize_Fuellen(var SourceStrings: TStringList);
  1550. Var
  1551.    S             : Integer;
  1552.    SrceStr, SStr,
  1553.    FormName      : String;
  1554.    Gefunden1,Gefunden2      : Boolean;
  1555. begin
  1556.   FormName:= GetFormName(SourceStrings);
  1557.   S := 0;
  1558.   Gefunden1:= Check(FormName+'.FormResize(',SourceStrings);
  1559.   Gefunden2 := Check(BrowserName+'.Height',SourceStrings);
  1560.   if Gefunden1 = False then begin
  1561.     Repeat
  1562.       SrceStr:= SourceStrings[S];
  1563.       SStr:= Uppercase(SrceStr);
  1564.       Strip(SStr);
  1565.       Inc(S);
  1566.     Until (Pos(UpperCase('END.'),SStr) > 0) or (S >= SourceStrings.Count);
  1567.     Dec(S);
  1568.     if BrowserName <> '' then begin
  1569.       SourceStrings.Insert(S,'Procedure '+FormName+'.FormResize(Sender: TObject);');
  1570.       inc(S);
  1571.       SourceStrings.Insert(S,'begin');
  1572.       Inc(S);
  1573.       SourceStrings.Insert(S,'{}'); {Damit Delphi mir das nicht wieder l÷scht}
  1574.       Inc(S);
  1575.       SourceStrings.Insert(S,'end;');
  1576.       Inc(S);
  1577.       SourceStrings.Insert(S,'');
  1578.       Inc(S);
  1579.     end;
  1580.     S:= 0;
  1581.   end;
  1582.   {FormResize-Rumpf wird gesucht}
  1583.   Repeat
  1584.    SrceStr:= SourceStrings[S];
  1585.    SStr:= Uppercase(SrceStr);
  1586.    Strip(SStr);
  1587.    Inc(S);
  1588.   Until (Pos(UpperCase(FormName+'.FORMRESIZE'),SStr) > 0) or (S >= SourceStrings.Count);
  1589.  
  1590.   {FormResize Begin wird gesucht}
  1591.   Dec(S);
  1592.   Repeat
  1593.     SrceStr:= SourceStrings[S];
  1594.     SStr:= Uppercase(SrceStr);
  1595.     Strip(SStr);
  1596.     Inc(S);
  1597.   Until (Pos('BEGIN',SStr) > 0) or (S >= SourceStrings.Count);
  1598.  
  1599.   if not Gefunden2 then begin
  1600.     if BrowserName <> '' then begin
  1601.       if Sprache = 1 then SErrorwindow('Browser.Height and Browser.Width added to FORMRESIZE')
  1602.       else SErrorwindow('Browser.Height und Browser.With wird in','FormResize eingetragen');
  1603.       SourceStrings.Insert(S,'  '+BrowserName+'.Height := ClientHeight-Header1.Height - 10;');
  1604.       inc(S);
  1605.       SourceStrings.Insert(S,'  '+BrowserName+'.Width := ClientWidth - 2;');
  1606.       inc(S);
  1607.     end;
  1608.   end;
  1609. end;
  1610.  
  1611.  
  1612. Procedure TIsamTable.FormShow_Fuellen(var SourceStrings: TStringList);
  1613. {ok}
  1614. Var
  1615.    S             : Integer;
  1616.    SrceStr, SStr,
  1617.    FormName      : String;
  1618.    Gefunden1,Gefunden2: Boolean;
  1619. begin
  1620.   S := 0;
  1621.   FormName:= GetFormName(SourceStrings);
  1622.   Gefunden1 := Check(FormName+'.FormShow(',SourceStrings);
  1623.   Gefunden2 := Check(BrowserName+'.KeyNumber := 1',SourceStrings);
  1624.   if Gefunden1 = False then begin
  1625.     Repeat
  1626.       SrceStr:= SourceStrings[S];
  1627.       SStr:= Uppercase(SrceStr);
  1628.       Strip(SStr);
  1629.       Inc(S);
  1630.     Until (Pos(UpperCase('END.'),SStr) > 0) or (S >= SourceStrings.Count);
  1631.     Dec(S);
  1632.     if BrowserName <> '' then begin
  1633.       SourceStrings.Insert(S,'Procedure '+FormName+'.FormShow(Sender: TObject);');
  1634.       inc(S);
  1635.       SourceStrings.Insert(S,'begin');
  1636.       Inc(S);
  1637.       SourceStrings.Insert(S,'{}'); {Damit Delphi mir das nicht wieder l÷scht}
  1638.       Inc(S);
  1639.       SourceStrings.Insert(S,'end;');
  1640.       Inc(S);
  1641.       SourceStrings.Insert(S,'');
  1642.       Inc(S);
  1643.     end;
  1644.     S:= 0;
  1645.   end;
  1646.   {FormShow-Rumpf wird gesucht}
  1647.   Repeat
  1648.    SrceStr:= SourceStrings[S];
  1649.    SStr:= Uppercase(SrceStr);
  1650.    Strip(SStr);
  1651.    Inc(S);
  1652.   Until (Pos(UpperCase(FormName+'.FORMSHOW'),SStr) > 0) or (S >= SourceStrings.Count);
  1653.   {FormShow Begin wird gesucht}
  1654.   Dec(S);
  1655.   Repeat
  1656.     SrceStr:= SourceStrings[S];
  1657.     SStr:= Uppercase(SrceStr);
  1658.     Strip(SStr);
  1659.     Inc(S);
  1660.   Until (Pos('BEGIN',SStr) > 0) or (S >= SourceStrings.Count);
  1661.  
  1662.   if not Gefunden2 then begin
  1663.     if BrowserName <> '' then begin
  1664.       SourceStrings.Insert(S,'  '+Name+'.KeyNo:= '+BrowserName+'.ReadIni;');
  1665.       inc(S);
  1666.       if Sprache = 1 then SErrorwindow('Browser.KeyNumber and Section added to FORMSHOW','')
  1667.       else SErrorwindow('Browser.KeyNumber und Section wird in','FormShow eingetragen');
  1668.       SourceStrings.Insert(S,'  '+BrowserName+'.ClearIncss;');
  1669.       inc(S);
  1670.       SourceStrings.Insert(S,'  '+BrowserName+'.KeyNumber := 1;');
  1671.       inc(S);
  1672.       SourceStrings.Insert(S,'  '+BrowserName+'.KeySection := 0;');
  1673.       inc(S);
  1674.       SourceStrings.Insert(S,'  '+BrowserName+'.AllowIncSS := True;');
  1675.       inc(S);
  1676.       SourceStrings.Insert(S,'  '+BrowserName+'.SetAndUpdateBrowserScreen('+Chr(39)+Chr(39)+', 0);');
  1677.       inc(S);
  1678.     end;
  1679.   end;
  1680. end;
  1681.  
  1682.  
  1683. Procedure TIsamTable.HeaderCreate_Einfuegen(var SourceStrings: TStringList);
  1684. {ok}
  1685. var SrceStr,SStr: String;
  1686.     Gefunden    : Boolean;
  1687.     i           : Byte;
  1688.     S           : Integer;
  1689.     FormName    : String;
  1690.  
  1691. begin
  1692.   if (HeaderName <> '') and (BrowserName <> '') then begin
  1693.     if Check('Procedure '+HeaderName+'Sized(Sender',SourceStrings) then
  1694.     begin
  1695.       if Sprache = 1 then SErrorwindow('Procedure Header.Sized already exists','')
  1696.       else SErrorwindow('Procedure Header.Sized()','existiert bereits.');
  1697.       exit;
  1698.     end;
  1699.     FormName:= GetFormName(SourceStrings);
  1700.     S:= 0;
  1701.     Gefunden:= False;
  1702.     Repeat
  1703.       SrceStr:= SourceStrings[S];
  1704.       SStr:= Uppercase(SrceStr);
  1705.       Strip(SStr);
  1706.       if Pos(UpperCase('Procedure'+HeaderName+'Sized'),SStr) > 0 then Gefunden:= True;
  1707.       Inc(S);
  1708.     Until (Pos('PRIVATE',SStr) > 0) or (S >= SourceStrings.Count);
  1709.     if Gefunden = False then
  1710.     begin
  1711.       Dec(S);
  1712.       SourceStrings.Insert(S,'    Procedure '+HeaderName+'Sized(Sender: TObject; ASection, AWidth: Integer);');
  1713.       Inc(S);
  1714.       if Sprache = 1 then SErrorwindow('Procedure Header.Sized added','')
  1715.       else SErrorwindow('Procedure Header.Sized()','wird eingetragen.');
  1716.     end;
  1717.     Repeat
  1718.       SrceStr:= SourceStrings[S];
  1719.       SStr:= Uppercase(SrceStr);
  1720.       Strip(SStr);
  1721.       Inc(S);
  1722.     Until (Pos('{$R*.DFM',SStr) > 0) or (S >= SourceStrings.Count);
  1723.  
  1724.     Repeat
  1725.       SrceStr:= SourceStrings[S];
  1726.       SStr:= Uppercase(SrceStr);
  1727.       Strip(SStr);
  1728.       Inc(S);
  1729.     Until (Pos(UpperCase('Procedure'+FormName+'.'+HeaderName+'Sized(Sender'),SStr) > 0)
  1730.           or (S >= SourceStrings.Count);
  1731.     if Pos(UpperCase('Procedure'+FormName+'.'+HeaderName+'Sized(Sender'),SStr) = 0 then
  1732.     begin
  1733.       S:= 0;
  1734.       Repeat
  1735.         SrceStr:= SourceStrings[S];
  1736.         SStr:= Uppercase(SrceStr);
  1737.         Strip(SStr);
  1738.         Inc(S);
  1739.       Until (Pos(UpperCase('END.'),SStr) > 0) or (S >= SourceStrings.Count);
  1740.       Dec(S);
  1741.       SourceStrings.Insert(S,'Procedure '+FormName+'.'+HeaderName+
  1742.                              'Sized(Sender: TObject;  ASection, AWidth: Integer);');
  1743.       Inc(S);
  1744.       SourceStrings.Insert(S,'begin');
  1745.       inc(S);
  1746.       SourceStrings.Insert(S,'  {'+BrowserName+'.ResizeHeader;}');
  1747.       inc(S);
  1748.       SourceStrings.Insert(S,'  '+BrowserName+'.SetAndUpdateBrowserScreen('+Chr(39)+Chr(39)+', 0);');
  1749.       inc(S);
  1750.       SourceStrings.Insert(S,'end;');
  1751.       inc(S);
  1752.       SourceStrings.Insert(S,'');
  1753.       inc(S);
  1754.       if Sprache = 1 then then sErrorwindow('Procedure Header.Sized added','')
  1755.       else SErrorwindow('Procedure Header.Sized() ','wird eingetragen.');
  1756.     end;
  1757.   end;
  1758. end;
  1759.  
  1760. Procedure TIsamTable.Browser_BuildRow_Einfuegen(var SourceStrings: TStringList);
  1761. {ok}
  1762. var SrceStr,SStr: String;
  1763.     Gefunden    : Boolean;
  1764.     i           : Byte;
  1765.     S           : Integer;
  1766.     FormName    : String;
  1767.  
  1768. begin
  1769.   if BrowserName <> '' then begin
  1770.     if Check('Function '+BrowserName+'BuildRow(',SourceStrings) then
  1771.     begin
  1772.       if Sprache = 1 then then SErrorwindow(BrowserName+'Buildrow already exists','')
  1773.       else SErrorwindow(BrowserName+'BuildRow()','existiert bereits.');
  1774.       Exit;
  1775.     end;
  1776.     FormName:= GetFormName(SourceStrings);
  1777.     S:= 0;
  1778.     Gefunden:= False;
  1779.     Repeat
  1780.       SrceStr:= SourceStrings[S];
  1781.       SStr:= Uppercase(SrceStr);
  1782.       Strip(SStr);
  1783.       if Pos(UpperCase('Function'+FormName+'.'+
  1784.          BrowserName+'BuildRow('),SStr) > 0 then Gefunden:= True;
  1785.       Inc(S);
  1786.     Until (Pos('PRIVATE',SStr) > 0) or (S >= SourceStrings.Count);
  1787.     if Gefunden = False then
  1788.     begin
  1789.       Dec(S);
  1790.       SourceStrings.Insert(S,'    Function '+BrowserName+'BuildRow(Sender: TObject; var RR: RowRec): Integer;');
  1791.       Inc(S);
  1792.       if Sprache = 1 then then SErrorwindow('Function Buildrow will be added','')
  1793.       else SErrorwindow('Function BuildRow','wird eingetragen.');
  1794.     end;
  1795.     Repeat
  1796.       SrceStr:= SourceStrings[S];
  1797.       SStr:= Uppercase(SrceStr);
  1798.       Strip(SStr);
  1799.       Inc(S);
  1800.     Until (Pos('{$R*.DFM',SStr) > 0) or (S >= SourceStrings.Count);
  1801.     Repeat
  1802.       SrceStr:= SourceStrings[S];
  1803.       SStr:= Uppercase(SrceStr);
  1804.       Strip(SStr);
  1805.       Inc(S);
  1806.     Until (Pos(UpperCase('FUNCTION'+UpperCase(FormName)+'.'+UpperCase(BrowserName)+'BUILDROW'),SStr) > 0)
  1807.            or (S >= SourceStrings.Count);
  1808.     if Pos(UpperCase('FUNCTION'+UpperCase(FormName)+'.'+
  1809.        UpperCase(BrowserName)+'BUILDROW'),SStr) = 0 then
  1810.     begin
  1811.       S:= 0;
  1812.       Repeat
  1813.         SrceStr:= SourceStrings[S];
  1814.         SStr:= Uppercase(SrceStr);
  1815.         Strip(SStr);
  1816.         Inc(S);
  1817.       Until (Pos(UpperCase('END.'),SStr) > 0) or (S >= SourceStrings.Count);
  1818.       Dec(S);
  1819.       SourceStrings.Insert(S,'Function '+FormName+'.'+BrowserName+'BuildRow(Sender: TObject; var RR: RowRec): Integer;');
  1820.       Inc(S);
  1821.       SourceStrings.Insert(S,'begin');
  1822.       inc(S);
  1823.       SourceStrings.Insert(S,'  Result := NoError;');
  1824.       inc(S);
  1825.       SourceStrings.Insert(S,'  Satzlesen('+Name+'.IfbPtr,RR.Ref,'+RecordName
  1826.                                  +'Daten,'+RecordName+'Dup);');
  1827.       inc(s);
  1828.       SourceStrings.Insert(S,'  with '+RecordName+'Daten do begin');
  1829.       inc(S);
  1830.       SourceStrings.Insert(S,'    if RR.Status <> NoError then begin');
  1831.       inc(S);
  1832.       SourceStrings.Insert(S,'      RR.Row := F('+Chr(39)+'****  '+Chr(39)+' + RR.IKS, MaxCols);');
  1833.       inc(S);
  1834.       SourceStrings.Insert(S,'    end else begin');
  1835.       inc(S);
  1836.       SourceStrings.Insert(S,'      RR.Row:= '+BrowserName+
  1837.                '.GetRow('+RECORDName+'GetFeldProc,'+RecordName+'Data);');
  1838.       inc(S);
  1839.       SourceStrings.Insert(S,'    end;');
  1840.       inc(S);
  1841.       SourceStrings.Insert(S,'  end;');
  1842.       inc(S);
  1843.       SourceStrings.Insert(S,'end;');
  1844.       inc(S);
  1845.       if Sprache = 1 then then SErrorwindow('Function Buildrow added','')
  1846.       else SErrorwindow('Function BuildRow ','wird eingetragen.');
  1847.     end;
  1848.   end;
  1849. end;
  1850.  
  1851. Procedure TIsamTable.Browser_Edit_Einfuegen(var SourceStrings: TStringList);
  1852. var SrceStr,SStr: String;
  1853.     Gef1,Gef2   : Boolean;
  1854.     i           : Byte;
  1855.     S           : Integer;
  1856.     FormName    : String;
  1857. begin
  1858.   if BrowserName <> '' then begin
  1859.     Gef1:= Check('Procedure '+BrowserName+'DblClick(',SourceStrings);
  1860.     Gef2:= Check('Procedure '+FormName+'.'+BrowserName+'DblClick(',SourceStrings);
  1861.     FormName:= GetFormName(SourceStrings);
  1862.     if Gef1 = False then begin
  1863.       S:= 0;
  1864.       Repeat
  1865.         SrceStr:= SourceStrings[S];
  1866.         SStr:= Uppercase(SrceStr);
  1867.         Strip(SStr);
  1868.         Inc(S);
  1869.       Until (Pos('PRIVATE',SStr) > 0) or (S >= SourceStrings.Count);
  1870.       Dec(S);
  1871.       SourceStrings.Insert(S,'    Procedure '+BrowserName+'DblClick(Sender: TObject);');
  1872.       Inc(S);
  1873.     end;
  1874.     if Gef2 = False then begin
  1875.       S:= 0;
  1876.       Repeat
  1877.         SrceStr:= SourceStrings[S];
  1878.         SStr:= Uppercase(SrceStr);
  1879.         Strip(SStr);
  1880.         Inc(S);
  1881.       Until (Pos('END.',SStr) > 0) or (S >= SourceStrings.Count);
  1882.       Dec(S);
  1883.       SourceStrings.Insert(S,'procedure '+FormName+'.'+BrowserName+'DblClick(Sender: TObject);');
  1884.       Inc(S);
  1885.       SourceStrings.Insert(S,'begin');
  1886.       Inc(S);
  1887.       SourceStrings.Insert(S,'  '+EditFormIdent+':= T'+EditFormIdent+'.Create(Self);');
  1888.       Inc(S);
  1889.       SourceStrings.Insert(S,'  Try');
  1890.       Inc(S);
  1891.       SourceStrings.Insert(S,'    '+Name+'.Ref:= '+BrowserName+'.GetCurrentDatRef;');
  1892.       Inc(S);
  1893.       SourceStrings.Insert(S,'    '+EditFormIdent+'.'+EditFormIdent+'Table:= IsamTable1;');
  1894.       Inc(S);
  1895.       SourceStrings.Insert(S,'    '+EditFormIdent+'.SetData;');
  1896.       Inc(S);
  1897.       SourceStrings.Insert(S,'    '+Name+'.FindKey('+RecordName+'Data,'+RecordName+'Dup,'+Name+'.Key);');
  1898.       Inc(S);
  1899.       SourceStrings.Insert(S,'    '+EditFormIdent+'.ShowModal;');
  1900.       Inc(S);
  1901.       SourceStrings.Insert(S,'  Finally');
  1902.       Inc(S);
  1903.       SourceStrings.Insert(S,'    Application.OnHint:= NIL;');
  1904.       Inc(S);
  1905.       SourceStrings.Insert(S,'    '+EditFormIdent+'.Free;');
  1906.       Inc(S);
  1907.       SourceStrings.Insert(S,'    '+BrowserName+'.SetAndUpdateBrowserScreen('+Chr(39)+Chr(39)+', 0);');
  1908.       Inc(S);
  1909.       SourceStrings.Insert(S,'  end;');
  1910.       Inc(S);
  1911.       SourceStrings.Insert(S,'end;');
  1912.       Inc(S);
  1913.     end;
  1914.   end;
  1915. end;
  1916.  
  1917. Procedure TIsamTable.SetSourceCreate(Const Value: Boolean);
  1918. Var SourceStrings : TStringlist;
  1919.     Formname      : String;
  1920.     R,S           : Integer;
  1921. begin
  1922.   if FSourceCreate <> Value then
  1923.   begin
  1924.     FSourceCreate := False;
  1925.     if FrecordName = '' then begin
  1926.       if Sprache = 1 then then Errorwindow('No Record-Name assigned','')
  1927.       else Errorwindow('Kein Recordname angegeben!','');
  1928.       exit;
  1929.     end;
  1930. {$ifndef Test}
  1931.     if not exist(FUnitName) then
  1932.     if not ToolServices.SaveProject then
  1933.     begin
  1934.       if Sprache = 1 then Errorwindow('Project could not be saved','')
  1935.       else ErrorWindow('Project konnte nicht','gespeichert werden');
  1936.       exit;
  1937.     end;
  1938.     SourceStrings:= TStringList.Create;
  1939.     Toolservices.SaveFile(FUnitName);
  1940.     SourceStrings.LoadFromFile(FUnitName);
  1941. {$Else}
  1942.     SourceStrings:= TStringList.Create;
  1943.     FUnitName := 'C:\Filer\t2.Pas';
  1944.     SourceStrings.LoadFromFile(FunitName);
  1945. {$Endif}
  1946.     if SourceStrings.Count > 0 then
  1947.     begin
  1948.       FormName:= GetFormName(SourceStrings);
  1949.  
  1950.       if Sprache = 1 then SErrorwindow('add USES','')
  1951.       else Serrorwindow('Uses einfⁿgen','');
  1952.       Uses_Einfuegen(SourceStrings);
  1953.  
  1954.       if Sprache = 1 then SErrorwindow('add RECORD','')
  1955.       else Serrorwindow('Record einfⁿgen','');
  1956.       Record_Einfuegen(SourceStrings);
  1957.  
  1958.       if Sprache = 1 then SErrorwindow('add DATA','')
  1959.       else Serrorwindow('Data einfⁿgen','');
  1960.       Data_Einfuegen(SourceStrings);
  1961.  
  1962.       if Sprache = 1 then SErrorwindow('add GETFELDPROC','')
  1963.       else Serrorwindow('Getfeldproc einfⁿgen','');
  1964.       GetFeldProc_Einfuegen(SourceStrings);
  1965.  
  1966.       if Sprache = 1 then SErrorwindow('add KEYPROC','')
  1967.       else Serrorwindow('Keyproc einfⁿgen','');
  1968.       Key_Proc_Einfuegen(SourceStrings);
  1969.  
  1970.       if Sprache = 1 then SErrorwindow('add KEY-declaration','')
  1971.       else Serrorwindow('KeyDeklaration einfⁿgen','');
  1972.       Key_Deklaration_Einfuegen(SourceStrings);
  1973.  
  1974.       if Sprache = 1 then then SErrorwindow('add FORMCREATE','')
  1975.       else Serrorwindow('FormCreate einfⁿgen','');
  1976.       FormCreate_Einfuegen(SourceStrings);
  1977.  
  1978.       if Sprache = 1 then SErrorwindow('fill FORMCREATE','')
  1979.       else Serrorwindow('FormCreate Fⁿllen einfⁿgen','');
  1980.       FormCreate_Fuellen(SourceStrings);
  1981.  
  1982.       if Sprache = 1 then SErrorwindow('fill FORMSHOW','')
  1983.       else Serrorwindow('FormShow Fⁿllen einfⁿgen','');
  1984.       FormShow_Fuellen(SourceStrings);
  1985.  
  1986.       if Sprache = 1 then SErrorwindow('fill FORMRESIZE','')
  1987.       else Serrorwindow('FormResize Fⁿllen einfⁿgen','');
  1988.       FormResize_Fuellen(SourceStrings);
  1989.  
  1990.       if Sprache = 1 then SErrorwindow('add HEADERCREATE','')
  1991.       else Serrorwindow('HeaderCreate einfⁿgen','');
  1992.       HeaderCreate_Einfuegen(SourceStrings);
  1993.  
  1994.       if Sprache = 1 then SErrorwindow('add BUILDROW','')
  1995.       else Serrorwindow('BuildRow einfⁿgen','');
  1996.       Browser_BuildRow_Einfuegen(SourceStrings);
  1997.  
  1998.       if Sprache = 1 then SErrorwindow('delete brackets','')
  1999.       else SErrorwindow('Klammern L÷schen','');
  2000.       Klammern_Loeschen(SourceStrings);
  2001.  
  2002.       if EditFormIdent <> '' then begin
  2003.         if Sprache = 1 then then SErrorwindow('BROWSER-Edit','')
  2004.         else SErrorwindow('Browser-Editoraufruf','');
  2005.         Browser_Edit_Einfuegen(SourceStrings);
  2006.       end;
  2007.  
  2008. {$ifdef Test}
  2009.        FUnitName := 'C:\Filer\t2.Pas';
  2010. {$EndIf}
  2011.       SourceStrings.SaveToFile(FUnitName);
  2012. {$IfNDef Test}
  2013.       MySave;
  2014. {$Endif}
  2015.     end;
  2016.     SourceStrings.Free;
  2017.   end;
  2018. end;
  2019.         
  2020. {Procedure TIsamTable.SetEditorCreate(const Value: Boolean);
  2021. begin
  2022.   FEditorCreate:= False;
  2023.   if csDesigning in ComponentState then begin
  2024.     if IsamRecord.Count > 0 then begin
  2025.       Try
  2026.         EditorExperte:= TEditorExperte.Create(Application);
  2027.         EditorExperte.FTable.IsamRecord.Assign(IsamRecord);
  2028.         EditorExperte.FTable.IsamKeyProc.Assign(IsamKeyProc);
  2029.         EditorExperte.FTable.RecordName:= RecordName;
  2030.         if EditorExperte.ShowModal = mrOk then EditFormIdent:= EditorExperte.FormIdent;
  2031.       Finally
  2032.         EditorExperte.Free;
  2033.       End;
  2034.     end
  2035.     else Errorwindow('Bitte zunΣchst Record definieren','');
  2036.   end;
  2037. end;}
  2038. {$ENDIF}
  2039.  
  2040. begin
  2041.   FHandle:= InitToolDll;
  2042. end.
  2043.  
  2044.  
  2045.